package com.sangeng.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

@Repository
@Aspect
public class printLogAspect {

    //对那些方法增强
    @Pointcut("execution(* com.sangeng.service..*.*(..))")
    public void pt() {

    }
    //怎么增强

    @Before("pt()")
    public void printLog(JoinPoint joinPoint) {
        //输出被增强的方法所在的类名,方法名 调用时传入的参数
        String declaringTypeName = joinPoint.getSignature().getDeclaringTypeName();
        String name = joinPoint.getSignature().getName();
        Object[] args = joinPoint.getArgs();
        System.out.println(name);
    }
}
